package com.example.prison.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.prison.entity.VisitorList;
import com.example.prison.service.VisitorListService;
import com.example.prison.mapper.VisitorListMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
* @author jiang
* @description 针对表【visitor_list】的数据库操作Service实现
* @createDate 2024-06-03 15:14:59
*/
@Service
public class VisitorListServiceImpl extends ServiceImpl<VisitorListMapper, VisitorList>
    implements VisitorListService{

    @Autowired
    private VisitorListMapper visitorListMapper;

    @Override
    public PageInfo<VisitorList> get(int pageNumber, int pageSize, String visitorName, String beginTime,String endTime) {
        PageHelper.startPage(pageNumber, pageSize);
        return new PageInfo<>(visitorListMapper.get(visitorName,beginTime,endTime));
    }

    @Override
    public int add(VisitorList visitor) {
        visitorListMapper.add(visitor);
        return 1;
    }

    @Override
    public void delete(Integer[] ids) {
        visitorListMapper.deleteVisitorList(ids);
    }

    @Override
    public int update(VisitorList visitor, Integer id) {
        visitorListMapper.updateVisitorList(visitor, id);
        return 1;
    }

    @Override
    public VisitorList getById(Integer id) {
        return visitorListMapper.getById(id);
    }

    @Override
    public VisitorList getByIdCard( String idCard){
        return visitorListMapper.getByIdCard(idCard);
    }


}




